unit uCxtResource;

interface

uses
  SysUtils,
  Classes,
  Graphics,
  Windows;

function GetPicture(const name: string): TGraphic;

implementation

var
  bmp_loccity: Graphics.TBitmap;
  bmp_locmap: Graphics.TBitmap;
  graybmp_loccity: Graphics.TBitmap;
  graybmp_locmap: Graphics.TBitmap;
  bmp_loctrack: Graphics.TBitmap;
  bmp_imchat: Graphics.TBitmap;

function GetPicture(const name: string): TGraphic;
begin
  if SameText(name, 'LocateMap') then Result := bmp_locmap
  else if SameText(name, 'LocateCity') then Result := bmp_loccity
  else if SameText(name, 'GrayLocateMap') then Result := graybmp_locmap
  else if SameText(name, 'GrayLocateCity') then Result := graybmp_loccity
  else if SameText(name, 'TrackLine') then Result := bmp_loctrack
  else if SameText(name, 'Chat') then Result := bmp_imchat
  else Result := nil;
end;

procedure LoadResources;
begin
  bmp_loccity := Graphics.TBitmap.Create;
  bmp_locmap := Graphics.TBitmap.Create;
  graybmp_loccity := Graphics.TBitmap.Create;
  graybmp_locmap := Graphics.TBitmap.Create;
  bmp_loctrack := Graphics.TBitmap.Create;
  bmp_imchat := Graphics.TBitmap.Create;
  bmp_loccity.LoadFromResourceName(HInstance, 'loccity');
  bmp_locmap.LoadFromResourceName(HInstance, 'locmap');
  graybmp_loccity.LoadFromResourceName(HInstance, 'loccitygray');
  graybmp_locmap.LoadFromResourceName(HInstance, 'locmapgray');
  bmp_loctrack.LoadFromResourceName(HInstance, 'loctrack');
  bmp_imchat.LoadFromResourceName(HInstance, 'imchat');
  bmp_loccity.TransparentColor := clWhite;
  bmp_loccity.TransparentMode := tmAuto;
  bmp_loccity.Transparent := True;
  bmp_locmap.TransparentColor := clWhite;
  bmp_locmap.TransparentMode := tmAuto;
  bmp_locmap.Transparent := True;
  graybmp_loccity.TransparentColor := clWhite;
  graybmp_loccity.TransparentMode := tmAuto;
  graybmp_loccity.Transparent := True;
  graybmp_locmap.TransparentColor := clWhite;
  graybmp_locmap.TransparentMode := tmAuto;
  graybmp_locmap.Transparent := True;
  bmp_loctrack.TransparentColor := clWhite;
  bmp_loctrack.TransparentMode := tmAuto;
  bmp_loctrack.Transparent := True;
  bmp_imchat.TransparentColor := clWhite;
  bmp_imchat.TransparentMode := tmAuto;
  bmp_imchat.Transparent := True;
end;

procedure FreeResources;
begin
  bmp_loccity.Free;
  bmp_locmap.Free;
  graybmp_loccity.Free;
  graybmp_locmap.Free;
  bmp_loctrack.Free;
  bmp_imchat.Free;
end;

initialization
  LoadResources;

finalization
  FreeResources;
  
end.
